<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "menu";
$menutype = 2;

if (NULL!=$action){


   $field = array(
	"code",
	"name",
	"course",
	"date",
	"datedetails",
	"time",
	"venue",
	"country",
	"presented",
	"currency",
	"fee",
	"remark",
	"contact",
	"contact_tel",
	"contact_email",
	"status",
	"publish_date",
	"picture1",
	"picture2",
	"picture3",
	"picture4",
	"expiring_date",
	"currency1",
	"currency2",
	"currency3",
	"currency4",
	"currency5",
	"fee1",
	"fee2",
	"fee3",
	"fee4",
	"fee5",
	"description1",
	"description2",
	"description3",
	"description4",
	"description5","showcase","course_link","trainer_link","country2","price"
	);


   $content = array(
	$Code,
	$Name,
	$Course,
	"$Year-$Month-$Day",
	$DateDetails,
	$Time,
	$Venue,
	$Country,
	$Presented,
	$Currency,
	$Fee1,
	$Remark,
	$Contact,
	$ContactTel,
	$ContactEmail,
	$Status,
	"$myYear-$myMonth-$myDay",
	$Picture1_name,
	$Picture2_name,
	$Picture3_name,
	$Picture4_name,
	"$Year1-$Month1-$Day1",
	$Currency1,
	$Currency2,
	$Currency3,
	$Currency4,
	$Currency5,
	$Fee1,
	$Fee2,
	$Fee3,
	$Fee4,
	$Fee5,
	$Description1,
	$Description2,
	$Description3,
	$Description4,
	$Description5,$showcase,$course_link, $trainer_link, $Country2, $Fee1
	);

   myInsert($table,$field,$content);

	$dir = $table . "/";

	if ($Picture1) myUpload($Picture1,$Picture1_name,$dir);
	if ($Picture2) myUpload($Picture2,$Picture2_name,$dir);
	if ($Picture3) myUpload($Picture3,$Picture3_name,$dir);
	if ($Picture4) myUpload($Picture4,$Picture4_name,$dir);

	if ($sm_Picture1) myUpload($sm_Picture1,"sm_" . $Picture1_name,$dir);
	if ($sm_Picture2) myUpload($sm_Picture2,"sm_" . $Picture2_name,$dir);
	if ($sm_Picture3) myUpload($sm_Picture3,"sm_" . $Picture3_name,$dir);
	if ($sm_Picture4) myUpload($sm_Picture4,"sm_" . $Picture4_name,$dir);


   header("location:" . $rela_path . "share/msg.php?v=711&id=$parent_id");

   exit();

}

if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");
	exit();
}


require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");
require($rela_path . "bin/country.php");
?> 
<form name="form1" enctype="multipart/form-data" method="post" action="">
<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="parent_id" type="hidden" value="<?print($parent_id)?>">
<input name="Code" type="hidden" value="<?print($Code)?>">

  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image" type="image" onclick="Redirect('menu.php?id=<?=$parent_id?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image" type="image" src="../../images/bt_save.gif" width="76" height="22"  <?print($active)?>> 
      </td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right">&nbsp; </td>
    </tr>
    <tr> 
      <td><table border="0">
          <tr> 
            <td class="tdheader">Schedule No. :</td>
            <td> <?print($Code)?> </td>
          </tr>
          <tr> 
            <td class="tdheader">Description : </td>
            <td><textarea class="text" name="Name" cols="40" rows="2"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Course :</td>
            <td>

<?

if ($parent_id){

	$Query="Select name from course_basic WHERE id=$parent_id";
	$r=myQuery($Query);

	$label=$r[0][0];

	echo $label;
	echo "<input type=\"hidden\" name=\"Course\" value=\"" . eregi_replace("&", "&amp;", $label) . "\">";

}else{

$Query = "select name from course_basic";
$r = myQuery($Query);

$sourceData = array();

for ($i=0;$i<count($r);$i++){

	array_push($sourceData,$r[$i][0]);

	}


FFPSelectBox("Course",$value,$sourceData,$sourceLabel);
}
?>			  </td>
          </tr>
          <tr> 
            <td class="tdheader">Start on  :</td>
            <td><?print(FFPdate(date("Y-m-d")))?></td>
          </tr>
          <tr> 
            <td class="tdheader">Date Details :</td>
            <td><textarea class="text" name="DateDetails" cols="40" rows="4"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Time :</td>
            <td><textarea class="text" name="Time" cols="40" rows="4"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Venue : </td>
            <td><textarea class="text" name="Venue" cols="40" rows="4"></textarea></td>
          </tr>
          <tr>
            <td class="tdheader">Language :</td>
            <td><select name="Country2" class="select">
                <option value="Danish">Danish</option>
                <option value="English">English</option>
                <option value="Cantonese">Cantonese</option>
                <option value="Mandarin">Mandarin</option>
                <option value="Danish / English">Danish / English</option>
                <option value="Danish / Cantonese">Danish / Cantonese</option>
                <option value="Danish / Mandarin">Danish / Mandarin</option>
                <option value="Cantonese / English">Cantonese / English</option>
                <option value="English / Mandarin">English / Mandarin</option>
                <option value="Cantonese / Mandarin">Cantonese / Mandarin</option>
              </select>
            </td>
          </tr>
          <tr> 
            <td class="tdheader">Country :</td>
            <td><?print(FFPCountry("HONG KONG"))?></td>
          </tr>
          <tr> 
            <td class="tdheader">Presented in : </td>
            <td><input class="select" name="Presented" type="text" size="40" value="<?print($Presented)?>"></td>
          </tr>

<!--
          <tr> 
            <td class="tdheader">Fee :</td>
            <td> 

<?

$sourceData = array(
  "HKD",
  "USD",
  "GBP",
  "EURO",
  "DKK",
  );

FFPSelectBox("Currency",$value,$sourceData,$sourceLabel);

?>  
			  
			  <input  class="text" name="Fee" type="text" size="12"> </td>
          </tr>



-->

          <tr> 
            <td class="tdheader">Remark : </td>
            <td><input class="select" name="Remark" type="text" size="40" value="<?print($Remark)?>"></td>
          </tr>







          <tr> 
            <td class="tdheader">Contact Person :</td>
            <td><input class="text" name="Contact" type="text" size="40">			  </td>
          </tr>


          <tr> 
            <td class="tdheader">Contact Tel:</td>
            <td><input class="select" name="ContactTel" type="text" size="40" value="<?print($ContactTel)?>"></td>
          </tr>








          <tr> 
            <td class="tdheader">Contact E-mail :</td>
            <td><input class="text" name="ContactEmail" type="text" size="40"></td>
          </tr>





















          <tr> 
            <td class="tdheader">Picture 1</td>
            <td>
			
			<?removeImage($Picture1,"remove_1")?>
			
			<!--<br><b>(Normal Picture)</b><br>-->
			<?loadImage($Picture1,$rela_path . $PIC_DIR . "$table/")?> 
			<input type="file" class="text" name="Picture1" size="40">

			<br><b>(Smaller Picture)</b><br>
			<?loadSmallImage($Picture1,$rela_path . $PIC_DIR . "$table/")?>
			<input type="file" class="text" name="sm_Picture1" size="40">
			<br><br>            </td>
          </tr>



          <tr> 
            <td class="tdheader">Picture 2</td>
            <td>
			
			<?removeImage($Picture2,"remove_2")?>
			
			<!--<br><b>(Normal Picture)</b><br>-->
			<?loadImage($Picture2,$rela_path . $PIC_DIR . "$table/")?> 
			<input type="file" class="text" name="Picture2" size="40">

			<br><b>(Smaller Picture)</b><br>
			<?loadSmallImage($Picture2,$rela_path . $PIC_DIR . "$table/")?>
			<input type="file" class="text" name="sm_Picture2" size="40">
			<br><br>            </td>
          </tr>


          <tr> 
            <td class="tdheader">Picture 3</td>
            <td>
			
			<?removeImage($Picture3,"remove_3")?>
			
			<!--<br><b>(Normal Picture)</b><br>-->
			<?loadImage($Picture3,$rela_path . $PIC_DIR . "$table/")?> 
			<input type="file" class="text" name="Picture3" size="40">

			<br><b>(Smaller Picture)</b><br>
			<?loadSmallImage($Picture3,$rela_path . $PIC_DIR . "$table/")?>
			<input type="file" class="text" name="sm_Picture3" size="40">
			<br><br>            </td>
          </tr>



          <tr> 
            <td class="tdheader">Picture 4</td>
            <td>
			
			<?removeImage($Picture4,"remove_4")?>
			
			<!--<br><b>(Normal Picture)</b><br>-->
			<?loadImage($Picture4,$rela_path . $PIC_DIR . "$table/")?> 
			<input type="file" class="text" name="Picture4" size="40">

			<br><b>(Smaller Picture)</b><br>
			<?loadSmallImage($Picture4,$rela_path . $PIC_DIR . "$table/")?>
			<input type="file" class="text" name="sm_Picture4" size="40">
			<br><br>            </td>
          </tr>
<tr> 
            <td class="tdheader">Fee 1:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency1" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee1" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description1"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>
		  
        <tr> 
            <td class="tdheader">Fee 2:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency2" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee2" size=18 class="text" value="0"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description2"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr> 
            <td class="tdheader">Fee 3:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency3" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee3" size=18 class="text" value="0"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description3"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr style="display:none;"> 
            <td class="tdheader">Fee 4:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency4" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee4" size=18 class="text" value="0"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description4"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr style="display:none;"> 
            <td class="tdheader">Fee 5:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency5" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee5" size=18 class="text" value="0"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description5"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>		  
		  
		  
		  
        <!--  <tr> 
            <td class="tdheader">Fee 1:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency1" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee1" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description1"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>


          <tr> 
            <td class="tdheader">Fee 2:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency2" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee2" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description2"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr> 
            <td class="tdheader">Fee 3:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency3" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee3" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description3"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr> 
            <td class="tdheader">Fee 4:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency4" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee4" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description4"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>

          <tr> 
            <td class="tdheader">Fee 5:</td>
            <td>
<TABLE>
<TR>
	<TD>Currency:</TD>
	<TD><input type="text" name="Currency5" size=5 class="text"></TD>
</TR>
<TR>
	<TD>Fee:</TD>
	<TD><input type="text" name="Fee5" size=18 class="text"></TD>
</TR>
<TR>
	<TD>Description:</TD>
	<TD><textarea rows=5 cols=40 class=text name="Description5"></textarea></TD>
</TR>
</TABLE>            </td>
          </tr>-->

								  
         <!-- 
		  <TR>
        	<TD colspan=2 class="tdheader">Price (without VAT)</TD>
          </TR>
		  <tr> 
		 <TR>
        	<TD class="tdheader">Original Price</TD>
        	<TD><input type="text" name="Price" size=10 class="text" value=""></TD>
          </TR>
          <TR>
        	<TD class="tdheader">Special Price</TD>
        	<TD><input type="text" name="p_sp" size=10 class="text" value="" disabled></TD>
          </TR>
          <TR>
        	<TD class="tdheader">Special Group Price</TD>
        	<TD><input type="text" name="p_sgp" size=10 class="text" value="" disabled></TD>
          </TR>
          <TR>
        	<TD class="tdheader">VAT Amount </TD>
        	<TD><input type="text" name="Vat" size=10 class="text" value=""> (VAT>=0)</TD>
          </TR>
          <TR>
        	<TD colspan=2 class="tdheader">Price (with VAT)</TD>
          </TR>
          <TR>
        	<TD class="tdheader">Price</TD>
        	<TD><input type="text" name="Price2" size=10 class="text" value="" disabled></TD>
          </TR>
          <TR>
        	<TD class="tdheader">Special Price</TD>
        	<TD><input type="text" name="p_sp" size=10 class="text" value="" disabled></TD>
          </TR>
          <TR>
        	<TD class="tdheader">Special Group Price</TD>
        	<TD><input type="text" name="p_sgp" size=10 class="text" value="" disabled></TD>
          </TR>-->






          <tr>
            <td><strong>Course Name Link: </strong></td>
            <td><input name="course_link" type="text" class="text" id="course_link" size="40" /></td>
          </tr>
          <tr>
            <td><strong>Trainer Name Link: </strong></td>
            <td><input name="trainer_link" type="text" class="text" id="trainer_link" size="40" /></td>
          </tr>
          <tr>
            <td><strong>Sharing Showcase?</strong></td>
            <td><?
$sourceData = array(
1,
0,
);

$sourceLabel = array(
"Yes",
"No",

);

$boxName = "showcase";

FFPRadioBox($boxName,1,$sourceData,$sourceLabel);


?>            </td>
          </tr>
          <tr> 
            <td valign="top" class="tdheader">Publish :</td>
            <td> 
			
              <?

$sourceData = array(
  "Yes",
  "No",
  );

$boxName="Status";

$value=$Status;

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>            </td> 			  
          </tr>	


          <tr> 
                  <td class="tdheader">Publishing Date :</td>
                  <td><?print(FFPtime(date("Y-m-d H:i")))?></td>
                </tr>

          <tr> 
                  <td class="tdheader">Expiring Date :</td>
                  <td><?print(FFPdate1(date("Y-m-d H:i")))?></td>
                </tr>


				
				</table>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image2" type="image" onclick="Redirect('menu.php?id=<?=$parent_id?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image2" type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 
      </td>
    </tr>
  </table>
</form>
<?
require($rela_path . "inc/footer.php");
?>

